package chapter3.No3_1_等待和通知机制.f只通知一个线程;

/**
 * *：notify方法只能通知一个线程
 *    notifyAll方法通知所有的线程
 * Created by Administrator on 2016/11/17.
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        Object lock = new Object();
        ThreadA a = new ThreadA(lock);
        a.setName("a");
        ThreadA b = new ThreadA(lock);
        b.setName("b");
        ThreadA c = new ThreadA(lock);
        c.setName("c");

        a.start();
        b.start();
        c.start();
        Thread.sleep(1000);
//        synchronized (lock){
//            lock.notify();
//        }
//        synchronized (lock){
//            lock.notify();
//        }
//        synchronized (lock){
//            lock.notify();
//        }
//        synchronized (lock){
//            lock.notify();
//        }
//        synchronized (lock){
//            lock.notifyAll();
//        }

        System.out.println("END");
    }
}
